<template>
    <h2 style="text-align: center;">医生信息详情</h2>
    <table vocab="1" class="table table-bordered">
        <tbody>
            <tr>
                <th>医生名称</th>
                <th>
                    <span v-text="Info.Doctor_Name"></span>
                </th>
            </tr>

            <tr>
                <th>所属医院</th>
                <th>
                    <span v-text="Info.Doctor_Adress"></span>
                </th>
            </tr>

            <tr>
                <th>医生图片</th>
                <th>
                    <img :src="Info.Doctor_Img" style="width: 100px; height: 100px;" />
                  
                </th>
            </tr>

            <tr>
                <th>医生学历</th>
                <th>
                    <span v-text="Info.Doctor_Educational"></span>
                </th>
            </tr>

            <tr>
                <th>所属科室</th>
                <th>
                    <span v-text="Info.Dept_Name"></span>
                </th>
            </tr>

            <tr>
                <th>职称</th>
                <th>
                    <span v-text="Info.Professional_Name"></span>
                </th>
            </tr>

            <tr>
                <th colspan="2" style="text-align: center;">
                    <a href="/ShowDoctor" class="btn btn-success">返回列表</a>
                </th>
            </tr>
        </tbody>
    </table>
</template>


<script setup lang="ts">
    import {ref,onMounted} from 'vue';
    import axios from 'axios';
    import { useRoute } from 'vue-router';

    const route=useRoute();
    //修改响应式数据
    const Info=ref({
        Doctor_Id:route.params.id,
        Doctor_Name: "",
        Doctor_Adress: "",
        Doctor_Img: "",
        Doctor_Educational: "",
        Doctor_IsDelete: true,
        Dept_Id: "",
        Dept_Name: "",
        Professional_Id: "",
        Professional_Name: ""

    })
    //职称响应式数据
    const InfoPro=ref([{
        Professional_Id: 0,
        Professional_Name: ""
    }])
    //获取科室响应式数据
    const InfoDept=ref([{
        Dept_Id:0,
        Dept_Name:""
    }])
    //文档就绪函数
    onMounted(()=>{
        GetDepartments();//获取科室信息
        GetProfessionals();//获取职称信息
        FanTian();//反填
    })
    console.log(route.params.id)
    //反填
    const FanTian=()=>{
        axios.get("https://localhost:44306/api/Doctor/GetDoctor?id="+route.params.id)
        .then(res=>{
            Info.value=res.data
        })
    }
    //获取科室信息
    const GetDepartments=()=>{
        axios.get("https://localhost:44306/api/Ward/GetDepartments")
        .then(res=>{
            InfoDept.value=res.data
        })
    }
    //获取职称信息
    const GetProfessionals=()=>{
        axios.get("https://localhost:44306/api/Doctor/GetProfessionals")
        .then(res=>{
            InfoPro.value=res.data
        })
    }

</script>